import axios from 'axios';
import {API_VERSION, ALL_SERVICE_API} from '../api';

var qs = require('qs');

export const addressDicts = filters => {
  return axios.get(API_VERSION + 'address_dicts/tree', {params: {filters: filters}});
};

export const addressDictsSimpleWithType = filters => {
  return axios.get(API_VERSION + 'address_dicts/tree/contain/type', {params: {filters: filters}});
};

export const searchAddressDicts = params => {
  return axios.get(ALL_SERVICE_API + '/address-dicts', {params: params});
};

// 修改开通城市
export const changeIsOpenStatus = (id, status) => {
  return axios.post(ALL_SERVICE_API + '/address_dicts/update/isopen/by/id', qs.stringify({id: id, status: status}));
};

// 修改即将开通城市
export const changeIsAboutToOpenStatus = (id, status) => {
  return axios.post(ALL_SERVICE_API + '/address_dicts/update/isabouttoopen/by/id', qs.stringify({id: id, status: status}));
};
